package com.luoyuanxiangvip.web.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.luoyuanxiangvip.common.utils.AjaxResult;
import com.luoyuanxiangvip.common.vo.support.QueryPage;
import com.luoyuanxiangvip.core.entity.BizAnnouncement;
import com.luoyuanxiangvip.core.service.IBizAnnouncementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luoyuanxiang <p>luoyuanxiangvip.com</p>
 * @since 2019/5/30
 */
@RestController
@Api(description = "公告管理")
public class BizAnnouncementController {

    @Resource
    @Lazy
    private IBizAnnouncementService iBizAnnouncementService;

    @PostMapping("/announcement/list")
    @ApiOperation(value = "获取公告列表")
    public AjaxResult announcementList(@RequestBody QueryPage queryPage) {
        IPage<BizAnnouncement> page = iBizAnnouncementService.page(new Page<>(queryPage.getPage(), queryPage.getLimit()));
        return AjaxResult.success("获取公告列表成功", page);
    }
}
